package cn.leetcode;

import java.util.ArrayList;
import java.util.List;

public class Code590 {
    public List<Integer> postorder(Node root) {
        List<Integer> list = new ArrayList<>();
        postorder(root, list);
        return list;
    }

    public void postorder(Node root, List<Integer> result) {
        if(root == null){
            return ;
        }
        result.add(root.val);
        for(Node node : root.children){
            postorder(node, result);
        }
    }
}
